<?php
/**
 * @file
 * @package mileage
 * @version $Id$
**/

if (!defined('XOOPS_ROOT_PATH')) {
	exit;
}

if (!defined('MILEAGE_TRUST_PATH')) {
	define('MILEAGE_TRUST_PATH', XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname);
}

require_once MILEAGE_TRUST_PATH . '/class/MileageUtils.class.php';

// version file
include dirname(__FILE__) . '/include/version.php';

//
// Define a basic manifesto.
//
$modversion['name']          = _MI_MILEAGE_LANG_MILEAGE;
$modversion['version']       = floatval(_MILEAGE_VERSION);
$modversion['description']   = _MI_MILEAGE_DESC_MILEAGE;
$modversion['author']        = 'wye';
$modversion['credits']       = 'http://never-ever.info/';
$modversion['help']          = 'help.html';
$modversion['license']       = 'GPL';
$modversion['official']      = 0;
$modversion['image']         = 'module_icon.php';
$modversion['dirname']       = $mydirname;
$modversion['trust_dirname'] = $mytrustdirname;


$modversion['cube_style'] = true;
$modversion['legacy_installer'] = array(
	'installer'   => array(
		'class'     => 'Installer',
		'namespace' => 'Mileage',
		'filepath'  => MILEAGE_TRUST_PATH . '/admin/class/installer/MileageInstaller.class.php'
	),
	'uninstaller' => array(
		'class'     => 'Uninstaller',
		'namespace' => 'Mileage',
		'filepath'  => MILEAGE_TRUST_PATH . '/admin/class/installer/MileageUninstaller.class.php'
	),
	'updater' => array(
		'class'     => 'Updater',
		'namespace' => 'Mileage',
		'filepath'  => MILEAGE_TRUST_PATH . '/admin/class/installer/MileageUpdater.class.php'
	)
);
$modversion['disable_legacy_2nd_installer'] = false;

// Database Tables
$modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
$modversion['tables']  = array() ;

//
// Templates. 
//
$modversion['templates'] = array();

//
// Admin panel setting
//
$mod_handler =& xoops_gethandler('module');
$module_altsys =& $mod_handler->getByDirname('altsys');
if (file_exists(XOOPS_TRUST_PATH . '/libs/altsys/index.php') && is_object($module_altsys) && $module_altsys->get('isactive')) {
	$blockAdminUrl = '../altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=' . $mydirname;
	$templateAdminUrl = '../altsys/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $mydirname;
	$langAdminUrl = '../altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin&dirname=' . $mydirname;
	$blockLang = _MI_MILEAGE_ADMENU_MYBLOCKSADMIN;
	$tplLang = _MI_MILEAGE_ADMENU_MYTPLSADMIN;
} else {
	$blockAdminUrl = '../legacy/admin/index.php?action=BlockList';
	$templateAdminUrl = '../legacyRender/admin/index.php?action=TplfileList';
	$langAdminUrl = '';
	$blockLang = _MI_LEGACY_MENU_BLOCKLIST;
	$tplLang = _MI_LEGACYRENDER_ADMENU_TPLFILE_MANAGE;
}
$modversion['hasAdmin']   = 1;
$modversion['adminindex'] = 'admin/index.php';
$modversion['adminmenu']  = array(
	// Mile List
	array(
		'title'    => _MI_MILEAGE_ADMENU_MILE_LIST,
		'link'     => 'admin/index.php?action=MileList',
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_MILE_LIST,
		'show'     => true,
		'absolute' => false
	),
	// Mile Edit
	array(
		'title'    => _MI_MILEAGE_ADMENU_MILE_NEW,
		'link'     => 'admin/index.php?action=MileEdit',
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_MILE_NEW,
		'show'     => true,
		'absolute' => false
	),
	// Charge
	array(
		'title'    => _MI_MILEAGE_ADMENU_CHARGE,
		'link'     => 'admin/index.php?action=Charge',
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_CHARGE,
		'show'     => true,
		'absolute' => false
	),
	// Rec List
	array(
		'title'    => _MI_MILEAGE_ADMENU_REC,
		'link'     => 'admin/index.php?action=RecList',
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_REC,
		'show'     => true,
		'absolute' => false
	),
	// Block Admin
	array(
		'title'    => $blockLang,
		'link'     => $blockAdminUrl,
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_MYBLOCKSADMIN,
		'show'     => true,
		'absolute' => false
	),
	// Template Admin
	array(
		'title'    => $tplLang,
		'link'     => $templateAdminUrl,
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_MYTPLSADMIN,
		'show'     => true,
		'absolute' => false
	),
);
if (!empty($langAdminUrl)) {
	// Lang Adamin
	$modversion['adminmenu'][] = array(
		'title'    => _MI_MILEAGE_ADMENU_MYLANGADMIN,
		'link'     => $langAdminUrl,
		'keywords' => _MI_MILEAGE_KEYWORD_ADMENU_MYLANGADMIN,
		'show'     => true,
		'absolute' => false
	);
}



//
// Public side control setting
//
$modversion['hasMain'] = 1;
$modversion['hasSearch'] = 1;
$modversion['search']['file'] = 'include/search.inc.php';
$modversion['search']['func'] = $mydirname . '_search';
$modversion['sub'] = array();

//
// Config setting
//
$modversion['config'] = array(
	array(
		'name'        => 'url_approach',
		'title'       => '_MI_MILEAGE_URL_APPROCH',
		'description' => '_MI_MILEAGE_URL_APPROCH_DSC',
		'formtype'    => 'select',
		'valuetype'   => 'int',
		'default'     => '0' ,
		'options'     => array(
								'_MI_MILEAGE_URL_APPROCH_0' => '0',
								'_MI_MILEAGE_URL_APPROCH_1' => '1',
								'_MI_MILEAGE_URL_APPROCH_2' => '2',
								'_MI_MILEAGE_URL_APPROCH_3' => '3',
							),
	),
	array(
		'name'        => 'week_start',
		'title'       => '_MI_MILEAGE_WEEK_START',
		'description' => '_MI_MILEAGE_WEEK_START_DSC',
		'formtype'    => 'select',
		'valuetype'   => 'int',
		'default'     => '1',
		'options'     => array(
								'_MI_MILEAGE_WEEK_START_SUN' => '0',
								'_MI_MILEAGE_WEEK_START_MON' => '1',
								'_MI_MILEAGE_WEEK_START_TUE' => '2',
								'_MI_MILEAGE_WEEK_START_WED' => '3',
								'_MI_MILEAGE_WEEK_START_THU' => '4',
								'_MI_MILEAGE_WEEK_START_FRI' => '5',
								'_MI_MILEAGE_WEEK_START_SAT' => '6',
							),
	),
	array(
		'name'        => 'use_remittance',
		'title'       => '_MI_MILEAGE_USE_REMITTANCE',
		'description' => '_MI_MILEAGE_USE_REMITTANCE_DSC',
		'formtype'    => 'yesno',
		'valuetype'   => 'int',
		'default'     => '0',
		'options'     => array(),
	),
	array(
		'name'        => 'xcat_cat_gr',
		'title'       => '_MI_MILEAGE_CAT_GROUP',
		'description' => '_MI_MILEAGE_CAT_GROUP_DSC',
		'formtype'    => 'textbox',
		'valuetype'   => 'int',
		'default'     => '0',
		'options'     => array(),
	),
);



//
// Block setting
//
$modversion['blocks'] = array(
	1 => array(
		'func_num'        => 1,
		'file'            => 'mileBlock.class.php',
		'class'           => 'mileBlock',
		'name'            => _MI_MILEAGE_BLOCK_NAME_MY_MILE,
		'description'     => _MI_MILEAGE_BLOCK_DESC_MY_MILE,
		'options'         => '',
		'template'        => 'block_my_mile.html',
		'show_all_module' => false,
		'can_clone'       => TRUE,
		'visible_any'     => false
	),
	2 => array(
		'func_num'        => 2,
		'file'            => 'stampCard.class.php',
		'class'           => 'stampCard',
		'name'            => _MI_MILEAGE_BLOCK_NAME_STAMP_CARD,
		'description'     => _MI_MILEAGE_BLOCK_DESC_STAMP_CARD,
		'options'         => '0|0|0|0',
		'template'        => 'block_stamp_card.html',
		'show_all_module' => false,
		'can_clone'       => TRUE,
		'visible_any'     => false
	),
	3 => array(
		'func_num'        => 3,
		'file'            => 'ticket.class.php',
		'class'           => 'ticket',
		'name'            => _MI_MILEAGE_BLOCK_NAME_TICKET,
		'description'     => _MI_MILEAGE_BLOCK_DESC_TICKET,
		'options'         => '',
		'template'        => 'block_ticket.html',
		'show_all_module' => false,
		'can_clone'       => TRUE,
		'visible_any'     => false
	),
	4 => array(
		'func_num'        => 4,
		'file'            => 'accept.class.php',
		'class'           => 'accept',
		'name'            => _MI_MILEAGE_BLOCK_NAME_ACCEPT,
		'description'     => _MI_MILEAGE_BLOCK_DESC_ACCEPT,
		'options'         => '',
		'template'        => 'block_accept.html',
		'show_all_module' => false,
		'can_clone'       => TRUE,
		'visible_any'     => false
	),
);
